@*
    For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
*@
@{
}

<div class="layui-row layui-col-space10">
    <div class="layui-col-md12">
        <div class="layui-card">
            <div class="layui-card-header">
                开发环境
            </div>
            <div class="layui-card-body">
                Pear Button 参考 Element UI 样式 ，提供 Button 服务
            </div>
        </div>
    </div>
    <form class="layui-form" action="">
        @Html.AntiForgeryToken()
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-header">
                    简单使用
                </div>
                <div class="layui-card-body">

                    <button class="pear-btn pear-btn-primary submitbtn" lay-submit lay-filter="submit">更新数据库中菜单</button>&nbsp;&nbsp;
                    <button class="pear-btn pear-btn-primary submitbtn" lay-submit lay-filter="RefreshCacheSubmit">刷新缓存</button>&nbsp;&nbsp;
                    <button class="pear-btn pear-btn-danger submitbtn" lay-submit lay-filter="DeleteDbAllMenu">删除数据库所有菜单</button>&nbsp;&nbsp;
                </div>
            </div>
        </div>
    </form>
</div>

@section Scripts{
    <script>
        layui.define(['element', 'jquery', 'form', "button"], function () {
             var $ = layui.jquery
            var form = layui.form;
                 var  element = layui.element;
                var button = layui.button;

             //提交
             form.on('submit(submit)', function (obj) {
                 @*$.post("@(Url.Action("UpdateMenuData"))", {}, function (result) {
                     abc.success("刷新完成");
                 });*@
                 abc.post({url:'@(Url.Action("UpdateMenuData"))',successMsg: "更新数据库中菜单完成"});
                 return false;
             });

            //提交
            form.on('submit(RefreshCacheSubmit)', function (obj) {
                 @*$.post("@(Url.Action("RefreshCache"))", {}, function (result) {
                     abc.success("刷新缓存完成");
                 });*@
                 abc.post({url:'@(Url.Action("RefreshCache"))',successMsg: "刷新完成"});
                 return false;
             });
               //删除数据库所有菜单
            form.on('submit(DeleteDbAllMenu)', function (obj) {
                 @*$.post("@(Url.Action("DeleteDbAllMenu"))", {}, function (result) {
                     abc.success("删除数据库所有菜单完成");
                 });*@
                 abc.post({url:'@(Url.Action("DeleteDbAllMenu"))',successMsg: "删除数据库所有菜单完成"});
                 return false;
             });

            //创建或更新数据库
            form.on('submit(CreateOrUpdateTables)', function (obj) {
        @*$.post("@(Url.Action("DeleteDbAllMenu"))", {}, function (result) {
                abc.success("删除数据库所有菜单完成");
                });*@
                    abc.post({ url: '@(Url.Action("CreateOrUpdateTables"))', successMsg: "创建或更新数据库表完成" });
                return false;
            });
        })
    </script>
}
